package com.jason.www.dao;

import com.jason.www.domain.RolesPermissions;
import org.apache.ibatis.jdbc.SQL;

public class RolesPermissionsSqlProvider {

    public String insertSelective(RolesPermissions record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("roles_permissions");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=BIGINT}");
        }
        
        if (record.getRolesId() != null) {
            sql.VALUES("roles_id", "#{rolesId,jdbcType=BIGINT}");
        }
        
        if (record.getPermissionsId() != null) {
            sql.VALUES("permissions_id", "#{permissionsId,jdbcType=BIGINT}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(RolesPermissions record) {
        SQL sql = new SQL();
        sql.UPDATE("roles_permissions");
        
        if (record.getRolesId() != null) {
            sql.SET("roles_id = #{rolesId,jdbcType=BIGINT}");
        }
        
        if (record.getPermissionsId() != null) {
            sql.SET("permissions_id = #{permissionsId,jdbcType=BIGINT}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}